/*
 * @lc app=leetcode.cn id=1560 lang=javascript
 *
 * [1560] 圆形赛道上经过次数最多的扇区
 */



// @lc code=start
const f = (n, offset) => {
  return new Array(n).fill(0).map((_, k) => k + offset);
}
/**
 * @param {number} n
 * @param {number[]} rounds
 * @return {number[]}
 */
var mostVisited = function (n, rounds) {
  const start = rounds[0], end = rounds[rounds.length - 1];
  if (end >= start) {
    return f(end - start + 1, start);
  }
  return f(end, 1).concat(f(n - start + 1, start));
};
// @lc code=end

